﻿//********************************************************************
// 
//  file:  frmBrowser.cs
// 
//  (C) Copyright 2010, Diomede Corporation
//  All rights reserved
// 
//  Use, modification, and distribution is subject to   
//  the New BSD License (See accompanying file license.txt).
// 
//********************************************************************

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Diomede.Explorer
{
    public partial class frmBrowser : Form
    {
        public frmBrowser()
        {
            InitializeComponent();
            
        }

        public frmBrowser(string url)
        {
            InitializeComponent();
            Url = url;
        }

        public string Url { get; set; }

        private void frmBrowser_Load(object sender, EventArgs e)
        {
            webBrowser1.Navigate(Url);
            this.Icon = Diomede.Explorer.Properties.Resources.globe;
        }

        private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            if (webBrowser1.DocumentTitle == "Navigation Canceled")
            {
                this.Close();
            }
            
        }

        private void toolStripButtonBack_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void toolStripButtonSave_Click(object sender, EventArgs e)
        {
            webBrowser1.ShowSaveAsDialog();
        }

        private void toolStripButtonPrint_Click(object sender, EventArgs e)
        {
            webBrowser1.ShowPrintDialog();
        }


    }
}
